package com.zhoutao123.article.dubbo.provider.spring;

import com.zhoutao123.article.dubbo.provider.Color;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.core.type.AnnotationMetadata;

import java.util.List;

public class CustomerSelector implements ImportSelector {

  @Override
  public String[] selectImports(AnnotationMetadata metadata) {
    // 会从 spring.factories 文件中读取到定义
    List<String> colors =
        SpringFactoriesLoader.loadFactoryNames(Color.class, Color.class.getClassLoader());
    String[] classPathArray = new String[0];
    return colors.toArray(classPathArray);
  }
}
